package kevin.socketdemo;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 创建一个socket实例
 */
public class SoketInstance {

    private  int port;

    private ServerSocket socket;

    public SoketInstance(int port) {
        this.port = port;

    }



    public ServerSocket getSocketInstance()
    {
        try {
            socket =new ServerSocket(port);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return socket;
    }


    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public String toString() {
        return "SoketInstance{" +
                "port=" + port +
                ", socket=" + socket +
                '}';
    }
}
